package io;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class FOSDemo {
    public static void main(String[] args) throws IOException {
        File file = new File("fos.dat");
        FileOutputStream fos = new FileOutputStream(file); //根据File实例定义文件输出流

        //FileOutputStream fos = new FileOutputStream("fos.dat"); //定义文件输出流
        //fos.write(1); //向fos.dat中写入了1个字节
        //fos.write(2); //又向fos.dat中写入了1个字节
        //fos.write(-1);
        fos.write(256);
        System.out.println("写入完毕!");
        fos.close(); //关闭流
    }
}
